UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NkdScQkXm6zcBZHAc07nId2RTM+0HQaunR0Hvptvk1w='
WHERE
key_id = '0eecea4bd0c2ea93c2498ae6eeb3b249bf204e8970592ed622d89899c4d81ec1'
AND (
token = 'NkdScQkXm6zcBZHAc07nId2RTM+0HQaunR0Hvptvk1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)