UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X6P2VDG5i9NhqDVQBEukJoBJWfC0lGdT4yUIBJ5FYcs=' 
WHERE 
  key_id = '26f4412b63053ff35bdb2ae654ff30529f17e9ad38b09f0793da0dd2d8ca1777' 
  AND (
    token = 'X6P2VDG5i9NhqDVQBEukJoBJWfC0lGdT4yUIBJ5FYcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024