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