UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hYpAd4hJ2q7q0vFLQR8MElctS5O4wba6b2o6U8yxlXk='
WHERE
key_id = '8d52bea4a0eeaebe25af786302c5570d5f0c3a5f054f5f27854ed4e238f33aef'
AND (
token = 'hYpAd4hJ2q7q0vFLQR8MElctS5O4wba6b2o6U8yxlXk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)