UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lus4YZUgmFpr664Ncv3Ag37H5oF4uUV3SkKTALsVaOw=' 
WHERE 
  key_id = '7ed4b4d5553d73897083fd004799ef48734780c8f65d159da2e22c3f2e073a81' 
  AND (
    token = 'lus4YZUgmFpr664Ncv3Ag37H5oF4uUV3SkKTALsVaOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034