UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2Rpn9XDxtqGOh2lx50Lnc9VyL/nxSHqCnipIs5g9OCY='
WHERE
key_id = 'a21af0f983f6f13dbe732a6dce4d8af81253a67e2359b179826ca36d2d63edd5'
AND (
token = '2Rpn9XDxtqGOh2lx50Lnc9VyL/nxSHqCnipIs5g9OCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)