UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'onxOXB31HcZGSwZ9+UcJSqX7mYsr8tphdYpAnSpD5Qo=' 
WHERE 
  key_id = '7e3ef5c1589494000af21bf9f51a5504f203830ad34cc8e93c90bb4009b734d5' 
  AND (
    token = 'onxOXB31HcZGSwZ9+UcJSqX7mYsr8tphdYpAnSpD5Qo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035