UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j0gYfub7NXZ9pejke5ED29+enYkyJYRemoUjuPqhVt8=' 
WHERE 
  key_id = '94202238a781b76d451271aa70ac5faad668d8750c9083f74d402280b27b6428' 
  AND (
    token = 'j0gYfub7NXZ9pejke5ED29+enYkyJYRemoUjuPqhVt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039