UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '51NzoLwNHwZMaqZfxYut9Owa6VH3F/uctQwofPwmULI='
WHERE
key_id = 'e610dfb6c177ddc674a3a1ab159750532c068ac06a52fbb4836c3d96bc187ba0'
AND (
token = '51NzoLwNHwZMaqZfxYut9Owa6VH3F/uctQwofPwmULI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)