UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TwnCp47K2op2rfQMLFO9FPWhk3rUPtG0IfH93XJ5WKI='
WHERE
key_id = 'e4e6b5c456cb8e2d12482264adf5043bd52907eaf7320115e8ee1c844838dc51'
AND (
token = 'TwnCp47K2op2rfQMLFO9FPWhk3rUPtG0IfH93XJ5WKI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)