UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iKe7nv3Bf0LJ+BkDvchXgJpMoootkRQnSreosfflDRM=' 
WHERE 
  key_id = '23213386b01feb70e6682f0ff858e3748084cb679abbf3c472012c8218e36b50' 
  AND (
    token = 'iKe7nv3Bf0LJ+BkDvchXgJpMoootkRQnSreosfflDRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019