UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8R/1xYI+R0H6hwyFkEFkJaQROtEdj/FPCAo+DTg5DjA='
WHERE
key_id = '94ffe5410673c16dab8ed6334952ed6265489a9bea89a4fcf27cc64d1f46185a'
AND (
token = '8R/1xYI+R0H6hwyFkEFkJaQROtEdj/FPCAo+DTg5DjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)