UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OsVOL8WzNMy80yxYkn9jqBSu0TDqeG1k00oaeFtiytc='
WHERE
key_id = '59538ebfdd06fbdf1f093faa2368ee4175af771c61c5449fc3fa29d8413c858b'
AND (
token = 'OsVOL8WzNMy80yxYkn9jqBSu0TDqeG1k00oaeFtiytc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)