UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'enpw1KioWpj67KdKV2J3tkB45QejL5+8tJXmyc61bWA=' 
WHERE 
  key_id = '8f0f25cb39c69880baedb5c2c76fa4a3c6bb7fd303b1d05b132612da4a973315' 
  AND (
    token = 'enpw1KioWpj67KdKV2J3tkB45QejL5+8tJXmyc61bWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028