UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zAZsFMqd2GJA4Ix9u+UFxkNob+7Szi7sdGIl6LgSmf4=' 
WHERE 
  key_id = '77cec141bf9068f0eaff2deecaf6c23793279bc86f98c408127dc6cdcbe97a1b' 
  AND (
    token = 'zAZsFMqd2GJA4Ix9u+UFxkNob+7Szi7sdGIl6LgSmf4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041