UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jCAlMQvg84ZRcQQPWqc366kl+tGb+YlV6A/+eBwPjAI='
WHERE
key_id = '10585d16120a481f43abce18066f2243e0a2516a7ca963a07da6f8c22f02cb80'
AND (
token = 'jCAlMQvg84ZRcQQPWqc366kl+tGb+YlV6A/+eBwPjAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)