UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VccgbdnIL1ViXOVSM9Qfpon2+4q861/+0/JIhHoIID8=' 
WHERE 
  key_id = '51e4a792949dd2c6bef8a75f53da7869544bd4a6a030e8cee2d2e211f3aa13fe' 
  AND (
    token = 'VccgbdnIL1ViXOVSM9Qfpon2+4q861/+0/JIhHoIID8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022