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