UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZhSjt71CBqWDbJVX0IGw8Z2qenXW+9zcrQgy4mWJj4s='
WHERE
key_id = '3e697758c34aa2f890808264045f552789834417fc809f4d1b6d2409fa636f0c'
AND (
token = 'ZhSjt71CBqWDbJVX0IGw8Z2qenXW+9zcrQgy4mWJj4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)