UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OJZnB7Y7xvdKeWBqlKI5B3EZP9dzFUdTSCIS/lCDIuI=' 
WHERE 
  key_id = 'a7240a4016775235ac79f92068165fb702a5071d4fa2b2d7012c8d9a2c11817f' 
  AND (
    token = 'OJZnB7Y7xvdKeWBqlKI5B3EZP9dzFUdTSCIS/lCDIuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032