UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'emYISXg23I9HwZPxnQhk4Vt9rkLXOvrN/psp+dHTYHI='
WHERE
key_id = '5868fa4ef75ea29b0ac25157562c4cf40b98008b99ebdd864a39f82ab2f2d10c'
AND (
token = 'emYISXg23I9HwZPxnQhk4Vt9rkLXOvrN/psp+dHTYHI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)