UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xfIDZj3OnFVUO5LLggB0vicNz9gZ9ebHA+zzOGNIDrE=' 
WHERE 
  key_id = 'faca97b45e87658ebcf72c963df5d19c4295274e97fa3978751e7127c6c0de11' 
  AND (
    token = 'xfIDZj3OnFVUO5LLggB0vicNz9gZ9ebHA+zzOGNIDrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063