UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sg5pY4J+pHIc4mVk07Lv6ceqQmzJri+simqU6woBw8M='
WHERE
key_id = 'f82a1d148b86fdda21778ba3a293133f66b2ebd4256fb40be2d22bc0be67d5ef'
AND (
token = 'Sg5pY4J+pHIc4mVk07Lv6ceqQmzJri+simqU6woBw8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)