UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a6IGvR3OIPvdwJ99UQHUBwuTZdn6pz5t0hiso5VW1CQ=' 
WHERE 
  key_id = '571173339a65d8b42f2c2e017b8bdfae7bee3dbc4eaf716dec54287979e2095a' 
  AND (
    token = 'a6IGvR3OIPvdwJ99UQHUBwuTZdn6pz5t0hiso5VW1CQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037