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