UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RWUIhHvhmpR7SB3SxU+rFhYEZbmIijXpkLcDe58LlO4='
WHERE
key_id = 'e88de3e3f1360a2b9527a304946200f27bf8f30ed2c5955a4b4c93a0148ee771'
AND (
token = 'RWUIhHvhmpR7SB3SxU+rFhYEZbmIijXpkLcDe58LlO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)