UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+AXj3Tb8pv4LED4Sk3WFOs1X0EOzAAoIGvBEvhtxiHI=' 
WHERE 
  key_id = '59321ba1451a8ec568ac67f9e69ec9994332bede250042bf9b88864794cec434' 
  AND (
    token = '+AXj3Tb8pv4LED4Sk3WFOs1X0EOzAAoIGvBEvhtxiHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025