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