UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LWw8p4C3fqVKQzwZtS7ilg5t9z9TuobTrWehllwBs4o=' 
WHERE 
  key_id = '3bb33413e5785a4d71fc97387ba04b4bb19036d3829e4eb8e7b86fca6e8c8d6d' 
  AND (
    token = 'LWw8p4C3fqVKQzwZtS7ilg5t9z9TuobTrWehllwBs4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030