UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sZmuzmfnQlaJm2bK1qM1Wox/+KmMV87AZ9tDUA7T+xc='
WHERE
key_id = '8f7b1f2422f874702c58a18c1c182c31b004590f357d237a74227c7caaad52e6'
AND (
token = 'sZmuzmfnQlaJm2bK1qM1Wox/+KmMV87AZ9tDUA7T+xc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)