UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cL4Fc22RYxdhSrie99B4QzwPWMkd0z2eEbJx3HMf/lY='
WHERE
key_id = 'bb7ae272b769ee44762f996ee99f627fa21ffbb2fb145b69310cd2d31ee6a7ac'
AND (
token = 'cL4Fc22RYxdhSrie99B4QzwPWMkd0z2eEbJx3HMf/lY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)