UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9CuuLnUyn/EGcnAc+xvcYCEhoWUVlgpXmQAb227HUhg='
WHERE
key_id = '2a59e0f48c94870016b28685653f14817c6ed03bd8baa157b0178037f20f2626'
AND (
token = '9CuuLnUyn/EGcnAc+xvcYCEhoWUVlgpXmQAb227HUhg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)