UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MyFo7YPTpTxvaUpt8Z7cx+obtGRvM44fovglBHdSrn4='
WHERE
key_id = '4d7d75046db0feb9232f4b9057f50f0f8142dadeea541b5558cfc907ba38f3f1'
AND (
token = 'MyFo7YPTpTxvaUpt8Z7cx+obtGRvM44fovglBHdSrn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)