UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YxysVlFznDlSvOC13hnRIADcBmQBEe5WCYlIpBgNJiA='
WHERE
key_id = '9829be70c2635b7dea3782c20dbc43cd2e7ca6eedcdf91a8542b9780ec784722'
AND (
token = 'YxysVlFznDlSvOC13hnRIADcBmQBEe5WCYlIpBgNJiA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)