UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CGzXfE8jHDPlSUwhqm1pNorKiDbpBTAynvHWWDOkhQo='
WHERE
key_id = 'f15ddf06061999feef5e959a37214920f69171e4ac25083e24643d4edcae1dee'
AND (
token = 'CGzXfE8jHDPlSUwhqm1pNorKiDbpBTAynvHWWDOkhQo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)