UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wUh5nHtBWLLetSwfJCN61yVmPCo0RYJsEV9W8qRZ6qk='
WHERE
key_id = '787d795a490dd3fba373b19390c5d5d1424f4ba1a734c578c3fbde192ebd6b3c'
AND (
token = 'wUh5nHtBWLLetSwfJCN61yVmPCo0RYJsEV9W8qRZ6qk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)