UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xq5UlkZmN85aUyNHjrveVdIIwwncXB0Ja1A5eluVtE0=' 
WHERE 
  key_id = '494468d139c48f4d60006bcd6d4acf81431d1f288611e6ada91615aae5db6af5' 
  AND (
    token = 'Xq5UlkZmN85aUyNHjrveVdIIwwncXB0Ja1A5eluVtE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041