UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ait1m5xGCuCX23083j9ahFB6+/emmk9yWYL3v+/+c20=' 
WHERE 
  key_id = '97d1be3fba1422bddc2292ed77412b7963db9943435e90526acfc9eb9e1009f2' 
  AND (
    token = 'Ait1m5xGCuCX23083j9ahFB6+/emmk9yWYL3v+/+c20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027