UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dMH3ZTJpWnC7Bm2BHbjdAuVobXRQiaBbo73YPAHBy4A=' 
WHERE 
  key_id = '965ceb08120126a972093c7636e7eb8ece0c9b51cd3383db2d72d55fc9edeb44' 
  AND (
    token = 'dMH3ZTJpWnC7Bm2BHbjdAuVobXRQiaBbo73YPAHBy4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054