UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CAyhEXej8kv4W4helT2m6tvXJEblSLgBYn8DBZqSKuM=' 
WHERE 
  key_id = '19ae5d972bced95c615a481d0f5d48c173f1d4137c47e635afbfd597ee5feda5' 
  AND (
    token = 'CAyhEXej8kv4W4helT2m6tvXJEblSLgBYn8DBZqSKuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033