UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nwDYpir7beovsy5hw9KAuEytWcg+jrw1AFN03/SmvT0='
WHERE
key_id = '6d5a5c77087d42db6e8c516c9f8a77f1cd4f783c3400a763f6139bde593a9fa8'
AND (
token = 'nwDYpir7beovsy5hw9KAuEytWcg+jrw1AFN03/SmvT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)