UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iEfYUIDZcYjtacFgYxfHPCk4BJv2CBWqAuWRf0gtbiY=' 
WHERE 
  key_id = '02fdb78c398cadd7f708508aca92c1a02da9e789f4c779ef35106c79f566608d' 
  AND (
    token = 'iEfYUIDZcYjtacFgYxfHPCk4BJv2CBWqAuWRf0gtbiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024