UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SAzzZXLhMXAWUekLi7TdhsoZiO9gLEg0jE6aS9cyxI8=' 
WHERE 
  key_id = '6ef8b8c44fa7b87cc3082a890754a287e81d2a4faab54e4b3ee4b38e70347e9d' 
  AND (
    token = 'SAzzZXLhMXAWUekLi7TdhsoZiO9gLEg0jE6aS9cyxI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029