UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MorbnMmm8aTEYCtsQl1gxOV0S47cr9Ax7Cou5QW4618='
WHERE
key_id = '71e7dc55092db0ebeea69b02529fd3b1e83149df4f5f462c7502d857af44d7f3'
AND (
token = 'MorbnMmm8aTEYCtsQl1gxOV0S47cr9Ax7Cou5QW4618='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)