UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AOVve/tjljtaHsI9FN1h7XL9D24p2qOzxz6zUktJ1Fk=' 
WHERE 
  key_id = '27d31bfa0b6de16ea9705556f169013c9742c9c112bbad9258716109c62dc120' 
  AND (
    token = 'AOVve/tjljtaHsI9FN1h7XL9D24p2qOzxz6zUktJ1Fk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024