UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U47Bq2MCb3DsCve79Vd6nbkg4rf9V1IpAB/T3N7irgk=' 
WHERE 
  key_id = 'a5564da3b465688b8b446339a72df754390fda19d73614e5db7aa687be8ae3df' 
  AND (
    token = 'U47Bq2MCb3DsCve79Vd6nbkg4rf9V1IpAB/T3N7irgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043