UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2WSxzWPaDj17MW3Xg+FeABVliDx35DF0XfBlBPPXMOg='
WHERE
key_id = '99a68a246c6153f0513646b9bd04e39190075fd26389083d016d8f1aa799f5e9'
AND (
token = '2WSxzWPaDj17MW3Xg+FeABVliDx35DF0XfBlBPPXMOg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)