UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DSz16B5hrKvdNu/sJxfmIBvonmSq/+yV/Xcoay6TaZk='
WHERE
key_id = 'c7b41b908a7a8c8615f9f3be91163caefa000c8a13cf0a837a7d5b90912202ac'
AND (
token = 'DSz16B5hrKvdNu/sJxfmIBvonmSq/+yV/Xcoay6TaZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)