UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GDtry96naExFQZhwcXzTaENRMpp+80WwtpLH3yjsKag=' 
WHERE 
  key_id = 'a436426b6254db1da085152d0dc38fb80217eff7e27f1b2809dc35c919fbd6ee' 
  AND (
    token = 'GDtry96naExFQZhwcXzTaENRMpp+80WwtpLH3yjsKag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029