UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K3DhiJo6Ewt7Dmt+j1Sb9oFLPkaIzZl0DFziOE1LWHc=' 
WHERE 
  key_id = 'ec95c77eb0030c340c984c09e9154c661e606bba3851a61cfa041b540e572d56' 
  AND (
    token = 'K3DhiJo6Ewt7Dmt+j1Sb9oFLPkaIzZl0DFziOE1LWHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032