UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UXTJDphDtew5jDoX3WcpKLSM0LqncvkeNGJRgaztxsw=' 
WHERE 
  key_id = 'fa0c796b0de9d12cd59527c2887a2bd5741b495abfa37029b23dd7f7c2865da6' 
  AND (
    token = 'UXTJDphDtew5jDoX3WcpKLSM0LqncvkeNGJRgaztxsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038