UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KAaWGU7tqKl5DewxMv+LMgoo6Xjghp/s2sZzN4+HzdE=' 
WHERE 
  key_id = 'b701c546f252466bfca3256b723926d2e82fd88b0824eaaf653925dfbde17b54' 
  AND (
    token = 'KAaWGU7tqKl5DewxMv+LMgoo6Xjghp/s2sZzN4+HzdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021